web/src/pages/[...listing].astro
675 lines · 18764 bytes
1---
2
3import Layout from '@layouts/Layout.astro';
4import ServiceList from '@components/things/ServiceList.astro';
5import Comments from '@components/things/Comments.svelte';
6import GitHubDetailedInfo from '@components/things/GitHubDetailedInfo.astro';
7import PrivacyPolicyDetails from '@components/things/PrivacyPolicyDetails.astro';
8import WebsiteDetailedInfo from '@components/things/WebsiteDetailedInfo.astro';
9import DockerDetailedInfo from '@components/things/DockerDetailedInfo.astro';
10import IosAppDetailedInfo from '@components/things/IosAppDetailedInfo.astro';
11import DiscordDetailedInfo from '@components/things/DiscordDetailedInfo.astro';
12import RedditDetailedInfo from '@components/things/RedditDetailedInfo.astro';
13import SocialShare from '@components/form/Social.astro';
14import DataActions from '@components/things/DataActions.svelte';
15import type { AwesomePrivacy, Section, Service } from '../types/Service';
16import { fetchData, slugify } from '@utils/fetch-data';
17import { fetchGitHubStats } from '@utils/fetch-repo-info';
18import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy';
19import { fetchWebsiteInfo } from '@utils/fetch-website-info';
20import { fetchDockerData } from '@utils/fetch-docker-instructions';
21import { fetchIosInfo } from '@utils/fetch-ios-info';
22import { fetchDiscordInfo } from '@utils/fetch-discord-info';
23import { fetchRedditInfo } from '@utils/fetch-reddit-info';
24import { parseMarkdown, formatLink } from '@utils/parse-markdown';
25import { site } from '@utils/config';
26import FontAwesome from '@components/form/FontAwesome.svelte';
27import Button from '@components/form/Button.astro';
28
29interface Props extends Service {
30 slug: string;
31 parentSection: Section;
32 categoryName: string;
33}
34
35const {
36 name,
37 description,
38 url,
39 github,
40 tosdrId,
41 discordInvite,
42 subreddit,
43 iosApp,
44 icon,
45 followWith,
46 securityAudited,
47 openSource,
48 acceptsCrypto,
49 parentSection,
50 categoryName,
51} = Astro.props;
52
53
54/**
55 * Make a list of keywords, for the <meta keywords> tag
56 */
57const makeKeyWordTag = () => {
58 const keywords: string[] = [];
59 keywords.push(`open source ${parentSection.name}`);
60 keywords.push(`${parentSection.name} comparison`);
61 (parentSection.alternativeTo || []).forEach((alt: string) => {
62 keywords.push(`${alt} alternative`);
63 });
64 (parentSection.services || []).forEach((serv: Service) => {
65 keywords.push(`${serv.name} vs`);
66 });
67 keywords.push('private');
68 keywords.push('ad free');
69 keywords.push('encrypted');
70 keywords.push('open source software');
71 keywords.push('privacy respecting apps');
72 keywords.push('free tools');
73 return keywords.join(', ');
74};
75
76/**
77 * Make a page title
78 */
79const makePageTitle = () => {
80 return `${name} | ${parentSection.name} | ${categoryName} | Awesome Privacy`;
81};
82
83/**
84 * Make a string page intro, for the description tag
85 */
86const makeDescriptionTag = () => {
87 let description = `Analysis of ${name}, and other privacy-respecting ${parentSection.name} `;
88 if (parentSection.services) {
89 const serviceList = parentSection.services.map((serv: Service) => serv.name);
90 description += `Compare ${serviceList.join(' vs ')} more apps. `
91 }
92 if (parentSection.alternativeTo && parentSection.alternativeTo.length > 0) {
93 description += `The best secure encrypted alternatives to ${parentSection.alternativeTo.join(', ')} in 2024. `;
94 }
95 description += 'All this, and many more free and awesome tools and software.'
96 return description;
97};
98
99// Return a list of Services, except for the currtent one
100const filterServices = () => {
101 return parentSection.services.filter((service: Service) => service.name !== name);
102};
103
104export async function getStaticPaths() {
105 const pages = await fetchData().then((data) => {
106 const results: Array<Props> = [];
107 if (!data || !data.categories) return results;
108 (data as AwesomePrivacy).categories.forEach((category) => {
109 category.sections.forEach((section) => {
110 const services = (section.services || []).map((service) => {
111 return {
112 slug: `${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}`,
113 parentSection: section,
114 categoryName: category.name,
115 ...service,
116 };
117 });
118 results.push(...services);
119 });
120
121 });
122 return results;
123 });
124
125 return pages.map((props: Props) => {
126 return {params: { listing: props.slug }, props };
127 });
128}
129
130const makePaginationLinks = () => {
131 const allServices = parentSection.services || [];
132 const index = allServices.findIndex(item => item.name === name);
133 const previousItem = index > 0 ? allServices[index - 1].name : null;
134 const nextItem = index < allServices.length - 1 ? allServices[index + 1].name : null;
135 return { previous: previousItem, next: nextItem };
136};
137
138const { previous, next } = makePaginationLinks();
139
140
141const ignoredSites = ['github.gom', 'wikipedia.'];
142
143// Fetch detailed data about the services GitHub repo, privacy policy and website
144const githubData = github ? await fetchGitHubStats(github) : null;
145const privacyData = tosdrId ? await fetchTosdrPrivacy(tosdrId) : null;
146const iosData = iosApp ? await fetchIosInfo(iosApp) : null;
147const discordData = discordInvite ? await fetchDiscordInfo(discordInvite) : null;
148const redditData = subreddit ? await fetchRedditInfo(subreddit) : null;
149const dockerData = await fetchDockerData(name);
150const websiteData = (url && !ignoredSites.some(ignoredSite => url.includes(ignoredSite))) ? await fetchWebsiteInfo(url) : null;
151
152const findPrivacyPolicyLink = () => {
153 if (!privacyData) return null;
154 const docs = privacyData.parameters.documents;
155 if (docs) {
156 const privacyPolicy = (docs || []).find((doc) => doc.name.toLowerCase().includes('privacy policy'));
157 if (privacyPolicy) return privacyPolicy.url;
158 }
159 return `https://tosdr.org/en/service/${tosdrId}`;
160};
161
162const privacyPolicyLink = findPrivacyPolicyLink();
163
164const getApiEndpoint = () => {
165 return `https://api.awesome-privacy.xyz/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`;
166}
167
168---
169
170<Layout title={makePageTitle()} keywords={makeKeyWordTag()} description={makeDescriptionTag()} >
171 <main>
172 <section>
173 <div class="service-head">
174 <h2>{name}</h2>
175 <span class="url-wrap">
176 <a class="service-url" href={url}>{formatLink(url)}</a>
177 <span class="follow-with">{followWith}</span>
178 </span>
179 </div>
180 <div class="breadcrumbs">
181 <span>
182 <a href="/">Awesome Privacy</a>
183 ➔ <a href={`/${slugify(categoryName)}`}>{categoryName}</a>
184 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}>{parentSection.name}</a>
185 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`}>{name}</a>
186 </span>
187 </div>
188 <div class="intro">
189 <img
190 width="60"
191 height="60"
192 loading="lazy"
193 decoding="async"
194 class="service-icon"
195 alt={`${name} Icon`}
196 data-service-url={formatLink(url)}
197 src={icon || `https://icon.horse/icon/${formatLink(url)}`}
198 />
199 <div>
200 <p class="description" set:html={parseMarkdown(description)}></p>
201 <ul>
202 { url && (
203 <li>
204 <b>Homepage:</b>
205 <a href={url}>{formatLink(url)}</a>
206 </li>
207 )}
208 { github && (
209 <li>
210 <b>GitHub:</b>
211 <a href={`https://github.com/${github}`}>github.com/{github}</a>
212 </li>
213 )}
214 { tosdrId && (
215 <li>
216 <b>Privacy:</b>
217 <a href={privacyPolicyLink}>{formatLink(privacyPolicyLink || '')}</a>
218 </li>
219 )}
220 { iosApp && (
221 <li>
222 <b>iOS App:</b>
223 <a href={iosApp}>{formatLink(iosApp)}</a>
224 </li>
225 )}
226 <!-- { androidApp && (
227 <li>
228 <b>Android App:</b>
229 <a href={androidApp}>{formatLink(androidApp)}</a>
230 </li>
231 )} -->
232 { discordInvite && (
233 <li>
234 <b>Discord Invite:</b>
235 <a href={`https://discord.com/invite/${discordInvite}`}>{discordInvite}</a>
236 </li>
237 )}
238 { subreddit && (
239 <li>
240 <b>Subreddit:</b>
241 <a href={`https://reddit.com/r/${subreddit}`}>r/{subreddit}</a>
242 </li>
243 )}
244 { url && (
245 <li>
246 <b>Web info:</b>
247 <a href={`https://web-check.xyz/results/${formatLink(url)}`}>{`web-check.xyz/results/${formatLink(url).split('/')[0]}`}</a>
248 </li>
249 )}
250 </ul>
251 </div>
252 </div>
253 <div class="highlights">
254 { securityAudited && (
255 <span class="meta-item great" title={`${name} has been security audited by an accredited auditor, with results published publicly`}>
256 <FontAwesome iconName="securityAudited" /> Security Audited
257 </span>
258 )}
259 { acceptsCrypto && (
260 <span class="meta-item great" title={`${name} accepts anonymous payment methods`}>
261 <FontAwesome iconName="cryptoAccepted" /> Crypto Payments Accepted
262 </span>
263 )}
264 { securityAudited === false && (
265 <span class="meta-item warning" title={`${name} has not been audited`}>
266 <FontAwesome iconName="notSecurityAudited" /> No Security Audit
267 </span>
268 )}
269 { (openSource === false) && (
270 <span class="warning">
271 <FontAwesome iconName="closedSource" />
272 Not Open Source
273 </span>
274 )}
275 { openSource || (github && openSource !== false) ? (
276 <span class="meta-item great" title={`${name} is open source`}>
277 <FontAwesome iconName="openSource" /> Open Source
278 </span>
279 ) : null }
280 </div>
281 </section>
282 { privacyData && privacyData.parameters.points.length > 0 && (
283 <section>
284 <h3>{name} Privacy Policy</h3>
285 <PrivacyPolicyDetails privacyData={privacyData} />
286 </section>
287 )}
288 { github && githubData && (
289 <section class="github-wrap">
290 <h3>{name} Source Code</h3>
291 <GitHubDetailedInfo gitHubData={githubData} repo={github} />
292 </section>
293 )}
294 { websiteData && (
295 <section>
296 <h3>{name} Website</h3>
297 <WebsiteDetailedInfo url={url} websiteInfo={websiteData} />
298 </section>
299 )}
300 { iosData && (
301 <section>
302 <h3>{name} iOS App</h3>
303 <IosAppDetailedInfo url={url} iosData={iosData} />
304 </section>
305 )}
306 { dockerData && dockerData.found && (
307 <section>
308 <h3>{name} Docker</h3>
309 <DockerDetailedInfo docker={dockerData} />
310 </section>
311 )}
312 { (discordData || redditData) && (
313 <section>
314 <h3>{name} Socials</h3>
315 <div class="social-wrap">
316 { discordData && <DiscordDetailedInfo discordData={discordData} /> }
317 { redditData && <RedditDetailedInfo redditData={redditData} /> }
318 </div>
319 </section>
320 )}
321
322 <section>
323 <h3>{name} Reviews</h3>
324 <Comments client:visible />
325 </section>
326
327 <section>
328 <h3>More {parentSection.name}</h3>
329 <ServiceList
330 services={filterServices()}
331 subHeading={true}
332 noGitHubMetrics={true}
333 buttonLink={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}
334 categoryName={categoryName}
335 sectionName={parentSection.name}
336 />
337 </section>
338 <section>
339 <h3>About the Data: {name}</h3>
340 <DataActions client:load categoryName={categoryName} sectionName={parentSection.name} serviceName={name} />
341 <h4>API</h4>
342 <p>
343 You can access {name}'s data programmatically via our API.
344 Simply make a <code>GET</code> request to:
345 </p>
346 <pre><a href={getApiEndpoint()}><code>{getApiEndpoint()}</code></a></pre>
347 <p>
348 The REST API is free, no-auth and CORS-enabled.
349 To learn more, view the <a href="/api">Swagger Docs</a> or read the <a href="/about#api">API Usage Guide</a>.
350 </p>
351
352 <h4>About the Data</h4>
353 <p>
354 Beyond the user-submitted YAML you see above, we also augment each listing with
355 additional data dynamically fetched from several sources.
356 To learn more about where the rest of data included in this page comes from,
357 and how it is computed,
358 see the <a href="/about#our-data">About the Data</a> section of our About page.
359 </p>
360 </section>
361
362 <section>
363 <h3>Share {name}</h3>
364 <p>
365 Help your friends compare {parentSection.name}, and pick privacy-respecting software and services.<br />
366 Share {name} and Awesome Privacy with your network!
367 <div>
368 <SocialShare
369 url={`${site}/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)} `}
370 title={`Checkout ${name}! \n`}
371 description={
372 `Compare #${name} and other privacy-respecting ${parentSection.name} at `
373 + `Awesome-Privacy.xyz, the free and open source list of private software alternatives. `
374 + `#privacy #opensource #awesomeprivacy by @Lissy_Sykes`}
375 />
376 </div>
377 </p>
378 </section>
379
380 <div class="pagination-navigation">
381 { previous ? (
382 <Button url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(previous)}`}>
383 <span>← Previous</span>
384 <p>{previous}</p>
385 </Button>
386 ) : <p class="nothing"></p>}
387 <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`} class="go-to-category">
388 View {parentSection.name} ({(parentSection.services || []).length})
389 </a>
390 { next && (
391 <Button url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(next)}`}>
392 <span>Next →</span>
393 <p>{next}</p>
394 </Button>
395 )}
396 </div>
397 </main>
398</Layout>
399
400<style lang="scss">
401
402main {
403 margin: 2rem auto;
404 padding: 1rem;
405 width: 1000px;
406 max-width: calc(100% - 5rem);
407 position: relative;
408 @media(max-width: 768px) {
409 max-width: 95%;
410 padding: 0.5rem;
411 margin: 0 auto;
412 }
413}
414
415section {
416 margin: 1rem 0 4rem 0;
417 padding: 1rem;
418 min-height: 8rem;
419 position: relative;
420 border: 2px solid var(--box-outline);
421 box-shadow: 6px 6px 0 var(--box-outline);
422 background: var(--accent-fg);
423
424}
425
426p {
427 margin: 0.25rem 0 0.5rem 0;
428}
429
430h3 {
431 font-size: 2rem;
432 margin: -2rem 0 1rem -2rem;
433 box-shadow: 6px 6px 0 var(--box-outline);
434 background: var(--accent);
435 color: var(--accent-fg);
436 width: fit-content;
437 padding: 0.25rem 0.5rem;
438 @media(max-width: 768px) {
439 margin: -2rem auto 2rem auto;
440 }
441 }
442
443.service-head {
444 h2 {
445 font-size: 3rem;
446 margin: 0;
447 @media(max-width: 768px) {
448 text-align: center;
449 }
450 }
451 .url-wrap {
452 display: flex;
453 align-items: center;
454 gap: 0.5rem;
455 a {
456 font-size: 1.2rem;
457 }
458 .follow-with {
459 font-style: italic;
460 opacity: 0.6;
461 }
462 @media(max-width: 768px) {
463 flex-direction: column;
464 }
465 }
466
467}
468
469.breadcrumbs {
470 opacity: 0.5;
471 font-size: 0.8rem;
472 position: absolute;
473 right: 1rem;
474 top: 1rem;
475 a {
476 color: var(--foreground);
477 transition: all 0.15s ease-in-out;
478
479 &:hover {
480 color: var(--accent);
481 }
482 }
483 @media(max-width: 768px) {
484 display: none;
485 }
486}
487
488h4 {
489 font-size: 1.4rem;
490 margin-bottom: 0;
491}
492
493.intro {
494 font-size: 1.2rem;
495 font-style: italic;
496 opacity: 0.9;
497 display: flex;
498 gap: 0.5rem;
499 @media(max-width: 768px) {
500 flex-direction: column;
501 }
502 .service-icon {
503 border-radius: var(--curve-md);
504 margin-top: 1rem;
505 @media(max-width: 768px) {
506 margin: 1rem auto 0 auto;
507 }
508 }
509 ul {
510 padding-left: 1rem;
511 list-style: circle;
512 font-style: normal;
513 font-size: 1rem;
514 margin-top: 0;
515 b {
516 font-size: 1rem;
517 font-weight: 400;
518 min-width: 85px;
519 display: inline-block;
520 @media(max-width: 768px) {
521 width: auto;
522 display: block;
523 }
524 }
525 }
526}
527
528.pagination-navigation {
529 display: flex;
530 justify-content: space-between;
531 align-items: center;
532 padding: 1rem 0;
533 :global(.button) {
534 min-width: 120px;
535 width: fit-content;
536 padding: 0.25rem 1rem;
537 text-align: right;
538 &:first-child { text-align: left; }
539 p {
540 margin: 0;
541 font-weight: normal;
542 font-size: 1rem;
543 }
544 span {
545 font-size: 0.8rem;
546 }
547
548 }
549 .nothing {
550 width: 120px;
551 }
552 .go-to-category {
553 color: var(--foreground);
554 font-size: 0.8rem;
555 opacity: 0.5;
556 @media (max-width: 768px) {
557 display: none;
558 }
559 }
560}
561
562
563
564.further-info, .notable-mentions, .word-of-warning {
565 h3 {
566 font-size: 1.4rem;
567 margin: 1rem 0;
568 }
569 :global(p) {
570 font-size: 0.9rem;
571 opacity: 0.7;
572 :global(strong) {
573 font-weight: 500;
574 }
575 :global(a) {
576 color: var(--foreground);
577 transition: all 0.15s ease-in-out;
578 &:hover {
579 color: var(--accent);
580 }
581 }
582 }
583 :global(strong) {
584 font-weight: 500;
585 }
586 :global(h4) {
587 font-size: 1.2rem;
588 margin: 0.5rem 0 0 0;
589 }
590 :global(ul) {
591 list-style: circle;
592 padding-left: 1rem;
593 font-size: 0.9rem;
594 opacity: 0.7;
595 li {
596 margin-bottom: 0.25rem;
597 :global(p) {
598 display: inline;
599 }
600 }
601 }
602}
603
604pre {
605 a {
606 text-decoration: none;
607 color: var(--foreground);
608 code {
609 background: #acabb782;
610 padding: 0.2rem 0.4rem;
611 border-radius: var(--curve-sm);
612 font-family: Courier New;
613 font-size: 0.9rem;
614 @media(max-width: 768px) {
615 white-space: break-spaces;
616 }
617 }
618 }
619}
620
621.social-wrap {
622 display: flex;
623 gap: 1rem;
624 flex-wrap: wrap;
625 justify-content: space-between;
626}
627
628.highlights {
629 display: flex;
630 gap: 1rem;
631 flex-wrap: wrap;
632 align-items: center;
633 justify-content: end;
634
635 .meta-item, .warning {
636 display: flex;
637 align-items: center;
638 // justify-content: center;
639 gap: 0.25rem;
640 opacity: 0.6;
641 font-size: 0.9rem;
642 padding: 0.5rem 0;
643 :global(svg) {
644 color: var(--foreground);
645 width: 1.2rem;
646 height: 1.2rem;
647 }
648 a {
649 text-decoration: none;
650 color: var(--foreground);
651 display: flex;
652 gap: 0.25rem;
653 &:hover {
654 color: var(--accent-3);
655 :global(svg) {
656 color: var(--accent-3);
657 }
658 }
659 }
660 }
661 .warning {
662 color: var(--danger);
663 :global(svg) {
664 color: var(--danger);
665 }
666 }
667 .great {
668 color: #007930; // var(--success);
669 :global(svg) {
670 color: #007930; // var(--success);
671 }
672 }
673}
674
675</style>